import 'package:flame/game.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../controllers/ecg_controller.dart';
import 'ecgrealarea.dart';

Widget buildTabViewEcg() {
  var controller = Get.find<EcgController>();
  controller.InitWaves();
  final ecgArea = EcgRealArea();
  return Column(
    children: [
      // 顶部状态栏
      Container(
        width: double.infinity,
        height: 40,
        decoration: const BoxDecoration(color: Colors.green),
      ),

      // 波形区域，可滚动
      Expanded(
        child: SingleChildScrollView(
          scrollDirection: Axis.vertical,
          child: Container(
            width:
                controller.ecgRecordWaves.values.first.waveContext.waveWidth(),
            height: controller.ecgRecordWaves.values.first.waveContext
                    .waveHeight() *
                controller.ecgRecordWaves.length,
            decoration: const BoxDecoration(color: Colors.black),
            child: GameWidget(game: ecgArea),
          ),
        ),
      ),

      // 底部状态栏
      Container(
        width: double.infinity,
        height: 40,
        decoration: const BoxDecoration(color: Colors.red),
      ),
    ],
  );
}
